package com.ruoyi.project.cms.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.cms.domain.BizStudentPostTask;
import com.ruoyi.project.cms.service.IBizStudentPostTaskService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 学生-岗位-评分Controller
 * 
 * @author ruoyi
 * @date 2023-03-18
 */
@RestController
@RequestMapping("/cms/post_task")
public class BizStudentPostTaskController extends BaseController
{
    @Autowired
    private IBizStudentPostTaskService bizStudentPostTaskService;

    /**
     * 查询学生-岗位-评分列表
     */
    @PreAuthorize("@ss.hasPermi('cms:post_task:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizStudentPostTask bizStudentPostTask)
    {
        startPage();
        List<BizStudentPostTask> list = bizStudentPostTaskService.selectBizStudentPostTaskList(bizStudentPostTask);
        return getDataTable(list);
    }

    /**
     * 导出学生-岗位-评分列表
     */
    @PreAuthorize("@ss.hasPermi('cms:post_task:export')")
    @Log(title = "学生-岗位-评分", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BizStudentPostTask bizStudentPostTask)
    {
        List<BizStudentPostTask> list = bizStudentPostTaskService.selectBizStudentPostTaskList(bizStudentPostTask);
        ExcelUtil<BizStudentPostTask> util = new ExcelUtil<BizStudentPostTask>(BizStudentPostTask.class);
        util.exportExcel(response, list, "学生-岗位-评分数据");
    }

    /**
     * 获取学生-岗位-评分详细信息
     */
    @PreAuthorize("@ss.hasPermi('cms:post_task:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bizStudentPostTaskService.selectBizStudentPostTaskById(id));
    }

    /**
     * 新增学生-岗位-评分
     */
    @PreAuthorize("@ss.hasPermi('cms:post_task:add')")
    @Log(title = "学生-岗位-评分", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizStudentPostTask bizStudentPostTask)
    {
        return toAjax(bizStudentPostTaskService.insertBizStudentPostTask(bizStudentPostTask));
    }

    /**
     * 修改学生-岗位-评分
     */
    @PreAuthorize("@ss.hasPermi('cms:post_task:edit')")
    @Log(title = "学生-岗位-评分", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizStudentPostTask bizStudentPostTask)
    {
        return toAjax(bizStudentPostTaskService.updateBizStudentPostTask(bizStudentPostTask));
    }

    /**
     * 删除学生-岗位-评分
     */
    @PreAuthorize("@ss.hasPermi('cms:post_task:remove')")
    @Log(title = "学生-岗位-评分", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizStudentPostTaskService.deleteBizStudentPostTaskByIds(ids));
    }
}
